package com.zg.scf.domain.req.company;

import com.zg.common.core.req.EditReq;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.util.Date;

/**
 * DESCRIPTION
 *
 * @author zhanfeng.liang
 * @since 2025-07-23
 */
@Data
@ApiModel(value = "公司EditReq", description = "公司信息")
public class CompanyEditReq extends EditReq {
    @ApiModelProperty(value = "统一社会信用代码（18位）", example = "911101010000000000", required = true)
    @NotBlank(message = "统一社会信用代码不能为空")
    @Pattern(regexp = "^[0-9A-HJ-NPQRTUWXY]{2}\\d{6}[0-9A-HJ-NPQRTUWXY]{10}$", message = "统一社会信用代码格式不正确")
    private String creditCode;

    @ApiModelProperty(value = "企业名称", example = "示例科技有限公司", required = true)
    @NotBlank(message = "企业名称不能为空")
    @Length(max = 100, message = "企业名称长度不能超过100字符")
    private String companyName;

    @ApiModelProperty(value = "省份", example = "北京市")
    @Length(max = 100, message = "省份长度不能超过100字符")
    private String province;

    @ApiModelProperty(value = "城市", example = "北京市")
    @Length(max = 100, message = "城市长度不能超过100字符")
    private String city;

    @ApiModelProperty(value = "区域", example = "海淀区")
    @Length(max = 100, message = "区域长度不能超过100字符")
    private String area;

    @ApiModelProperty(value = "详细地址", example = "北京市海淀区中关村大街1号")
    @Length(max = 200, message = "详细地址长度不能超过200字符")
    private String address;

    @ApiModelProperty(value = "营业开始日期", example = "2020-01-01")
    @NotNull(message = "营业开始日期不能为空")
    private Date bizBegin;

    @ApiModelProperty(value = "营业结束日期（长期有效可填null或9999-12-31）", example = "2050-01-01")
    private Date bizEnd;

    @ApiModelProperty(value = "注册资本单位（万元）", example = "1000")
    @NotNull(message = "注册资本单位不能为空")
    private Integer capitalUnit;

    @ApiModelProperty(value = "企业性质", example = "民营企业")
    @NotBlank(message = "企业性质不能为空")
    @Length(max = 100, message = "企业性质长度不能超过100字符")
    private String companyNature;

    @ApiModelProperty(value = "组织类型", example = "有限责任公司")
    @NotBlank(message = "组织类型不能为空")
    @Length(max = 100, message = "组织类型长度不能超过100字符")
    private String orgType;

    @ApiModelProperty(value = "信用代码图片路径（URL）", example = "http://example.com/credit_code.jpg")
    @NotBlank(message = "信用代码图片不能为空")
    @Length(max = 100, message = "信用代码图片路径长度不能超过100字符")
    private String creditCodeImg;

    @ApiModelProperty(value = "资质证书图片路径（URL）", example = "http://example.com/credential.jpg")
    @Length(max = 100, message = "资质证书图片路径长度不能超过100字符")
    private String credentialImg;

    @ApiModelProperty(value = "实缴资本单位（万元）", example = "500")
    private Integer realUnit;  // 非必填，部分企业可能未公示

    @ApiModelProperty(value = "是否上市（0：否；1：是）", example = "0")
    @NotNull(message = "是否上市标识不能为空")
    private Integer isListed;

    @ApiModelProperty(value = "股票代码（上市企业必填）", example = "600000")
    @Length(max = 20, message = "股票代码长度不能超过20字符")
    private String stockCode;  // 仅上市企业必填，可通过分组校验细化

    @ApiModelProperty(value = "股票简称（上市企业必填）", example = "浦发银行")
    @Length(max = 50, message = "股票简称长度不能超过50字符")
    private String stockShortName;

    @ApiModelProperty(value = "上市市场（上市企业必填）", example = "上交所")
    @Length(max = 50, message = "上市市场长度不能超过50字符")
    private String market;

    @ApiModelProperty(value = "主营业务", example = "软件开发、技术服务")
    @NotBlank(message = "主营业务不能为空")
    @Length(max = 1000, message = "主营业务长度不能超过1000字符")
    private String mainBusiness;

    @ApiModelProperty(value = "核心产品", example = "企业管理系统")
    @Length(max = 1000, message = "核心产品长度不能超过1000字符")
    private String coreProduct;

    @ApiModelProperty(value = "行业类型", example = "信息技术")
    @NotBlank(message = "行业类型不能为空")
    @Length(max = 50, message = "行业类型长度不能超过50字符")
    private String industryType;

    @ApiModelProperty(value = "集团名称（非集团企业可不填）", example = "示例集团")
    @Length(max = 100, message = "集团名称长度不能超过100字符")
    private String groupName;

    @ApiModelProperty(value = "邮政编码", example = "100080")
    @Pattern(regexp = "^[0-9]{6}$", message = "邮政编码格式不正确（6位数字）")
    private String postCode;

    @ApiModelProperty(value = "是否来自企查查（0：否；1：是）", example = "0")
    @NotBlank(message = "企查查来源标识不能为空")
    private String isQcc;

    @ApiModelProperty(value = "公司类型", example = "供应商")
    @NotBlank(message = "公司类型不能为空")
    @Length(max = 100, message = "公司类型长度不能超过100字符")
    private String companyType;

    @Valid
    private PersonAddReq agentAddReq;

    @Valid
    private PersonAddReq contactAddReq;
}
